﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using 基于WPF的电缆采样数据分析系统.Models.Enums;
using 基于WPF的电缆采样数据分析系统.ViewModels.TDRWork.TaskPage;

namespace 基于WPF的电缆采样数据分析系统.Views.TDRWork.TaskPage
{
    /// <summary>
    /// TaskPageUC.xaml 的交互逻辑
    /// </summary>
    public partial class TaskPageInfoUC : UserControl
    {
        public TaskPageInfoUC()
        {
            InitializeComponent();

            this.DataContext = TaskPageInfoUCViewModel.Instance;
        }

        /// <summary>
        /// X轴起点-计算器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void XASP_Click(object sender, RoutedEventArgs e)
        {
            CalculatorTaskUCViewModel.Instance.CurrentCalculatorValue = TaskPageInfoUCViewModel.Instance.XAxisStartPoint.ToString();
            CalculatorTaskUCViewModel.Instance.UnitInfo = "ns";
            CalculatorTaskUCViewModel.Instance.ParamType = AxisParameterType.XAxisStartPoint;
        }

        /// <summary>
        /// X轴终点-计算器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void XAEP_Click(object sender, RoutedEventArgs e)
        {
            CalculatorTaskUCViewModel.Instance.CurrentCalculatorValue = TaskPageInfoUCViewModel.Instance.XAxisEndPoint.ToString();
            CalculatorTaskUCViewModel.Instance.UnitInfo = "ns";
            CalculatorTaskUCViewModel.Instance.ParamType = AxisParameterType.XAxisEndPoint;
        }

        /// <summary>
        /// X轴刻度-计算器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void XAS_Click(object sender, RoutedEventArgs e)
        {
            CalculatorTaskUCViewModel.Instance.CurrentCalculatorValue = TaskPageInfoUCViewModel.Instance.XAxisScale.ToString();
            CalculatorTaskUCViewModel.Instance.UnitInfo = "ns";
            CalculatorTaskUCViewModel.Instance.ParamType = AxisParameterType.XAxisScale;
        }

        /// <summary>
        /// Y轴起点-计算器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void YASP_Click(object sender, RoutedEventArgs e)
        {
            CalculatorTaskUCViewModel.Instance.CurrentCalculatorValue = TaskPageInfoUCViewModel.Instance.YAxisStartPoint.ToString();
            CalculatorTaskUCViewModel.Instance.UnitInfo = "mV";
            CalculatorTaskUCViewModel.Instance.ParamType = AxisParameterType.YAxisStartPoint;
        }

        /// <summary>
        /// Y轴终点-计算器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void YAEP_Click(object sender, RoutedEventArgs e)
        {
            CalculatorTaskUCViewModel.Instance.CurrentCalculatorValue = TaskPageInfoUCViewModel.Instance.YAxisEndPoint.ToString();
            CalculatorTaskUCViewModel.Instance.UnitInfo = "mV";
            CalculatorTaskUCViewModel.Instance.ParamType = AxisParameterType.YAxisEndPoint;
        }

        /// <summary>
        /// Y轴刻度-计算器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void YAS_Click(object sender, RoutedEventArgs e)
        {
            CalculatorTaskUCViewModel.Instance.CurrentCalculatorValue = TaskPageInfoUCViewModel.Instance.YAxisScale.ToString();
            CalculatorTaskUCViewModel.Instance.UnitInfo = "mV";
            CalculatorTaskUCViewModel.Instance.ParamType = AxisParameterType.YAxisScale;
        }

        /// <summary>
        /// X轴平移-计算器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void XAT_Click(object sender, RoutedEventArgs e)
        {
            CalculatorTaskUCViewModel.Instance.CurrentCalculatorValue = TaskPageInfoUCViewModel.Instance.XAxisTranslation.ToString();
            CalculatorTaskUCViewModel.Instance.UnitInfo = "ns";
            CalculatorTaskUCViewModel.Instance.ParamType = AxisParameterType.XAxisTranslation;
        }

        /// <summary>
        /// Y轴平移-计算器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void YAT_Click(object sender, RoutedEventArgs e)
        {
            CalculatorTaskUCViewModel.Instance.CurrentCalculatorValue = TaskPageInfoUCViewModel.Instance.YAxisTranslation.ToString();
            CalculatorTaskUCViewModel.Instance.UnitInfo = "mV";
            CalculatorTaskUCViewModel.Instance.ParamType = AxisParameterType.YAxisTranslation;
        }
    }
}
